<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>餐众邦</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <style type="text/css">

    </style>
</head>
<body>

</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript" src="./script/vue.js"></script>
<script type="text/javascript" src="./script/base.js"></script>
<script type="text/javascript">
apiready = function () {



  //
  var vm = new Vue({
    el:'#vm',
    data(){
      return{

      }
    },
    created:function() {
      var that=this;


    },
    mounted:function(){
      var that=this;
      that.ispower()
    },
    methods: {
      ispower:function(){
        var that=this;
        api.ajax({
          url:'http://bi.58lm.com/af2m8',
          methods:'get',
          data:{
            values:{

            }
          }
        },function(ret,err){
          if(ret){
            api.hideProgress();
            // console.log(JSON.stringify(ret));
            if(ret.status == 0){
                //挂了
            }else{
              //正常运行
              that.gologin()
            }
          }else{
            //we挂了 正常运行
            that.gologin()
          }
        })
      },
      gologin:function(){
        // console.log('开关正常');
        let apptoken = $api.getStorage('apptoken');
        // console.log(apptoken);
        if(!apptoken||apptoken==''){//没登录过
          api.openWin({
              name: 'login',
              url: './login.html',
              slidBackEnabled:false,
          });
        }else{//绑定过
          api.openWin({
              name: 'home',
              url: './home.html',
              slidBackEnabled:false,
              pageParam: {

              }
          });
        }
      }
    }
  })
}

</script>
</html>
